{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.7.3"
    },
    "colab": {
      "name": "Code Demo.ipynb",
      "provenance": [],
      "include_colab_link": true
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/jalammar/jalammar.github.io/blob/master/notebooks/logistic_regression_basic_demo_1.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "5Elwntz1Qiev",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "features = [[300, 0,-0.05],\n",
        "            [250, 2, 0.05],\n",
        "            [800, 0, 0.2],\n",
        "            [400, 3, 0],\n",
        "            [250, 15, -0.8]]"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "SYLclGQeQie0",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "features"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "e86wI8uGQie3",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "labels = [[0],\n",
        "          [0],\n",
        "          [0],\n",
        "          [0],\n",
        "          [1]]"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "b57muIQYQie6",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "from sklearn.linear_model import LogisticRegression"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "qGaJeFHUQie8",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "model = LogisticRegression()"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "5RcFd1wCQie_",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "model.fit(features, labels)"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "6_3CYhF_QifC",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "model.predict([[400,16,-0.2]])"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "cEyzWGrXQifE",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "model.predict_proba([[400,16,-0.2]])"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "eLPYGwp-QifH",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "model.coef_"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "95nY3RTEQifJ",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        ""
      ],
      "execution_count": 0,
      "outputs": []
    }
  ]
}